   1              		.syntax unified
   2              		.cpu cortex-m3
   3              		.fpu softvfp
   4              		.eabi_attribute 20, 1
   5              		.eabi_attribute 21, 1
   6              		.eabi_attribute 23, 3
   7              		.eabi_attribute 24, 1
   8              		.eabi_attribute 25, 1
   9              		.eabi_attribute 26, 1
  10              		.eabi_attribute 30, 4
  11              		.eabi_attribute 34, 1
  12              		.eabi_attribute 18, 4
  13              		.thumb
  14              		.syntax unified
  15              		.file	"modbus_master.c"
  16              		.text
  17              	.Ltext0:
  18              		.cfi_sections	.debug_frame
  19              		.section	.text.ValidatePacket,"ax",%progbits
  20              		.align	1
  21              		.thumb
  22              		.thumb_func
  24              	ValidatePacket:
  25              	.LFB4:
  26              		.file 1 "uc_libc_dev/protocol/modbus/modbus_master.c"
   1:uc_libc_dev/protocol/modbus/modbus_master.c **** /* Criado em 20/04/2015
   2:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Atualização:
   3:uc_libc_dev/protocol/modbus/modbus_master.c ****  * 	12/08/2016 - Retirado controle de tempo pela função now
   4:uc_libc_dev/protocol/modbus/modbus_master.c ****  * 	29/04/2015
   5:uc_libc_dev/protocol/modbus/modbus_master.c **** 
   6:uc_libc_dev/protocol/modbus/modbus_master.c ****  *
   7:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Biblioteca MODBUS mestre barramento serial rs232/rs485 no modo RTU (Binário)
   8:uc_libc_dev/protocol/modbus/modbus_master.c ****  *
   9:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Este protocolo atende somente as funções:
  10:uc_libc_dev/protocol/modbus/modbus_master.c ****  * 	 Leituta de muitos registradores, código 3,
  11:uc_libc_dev/protocol/modbus/modbus_master.c ****  * 	 Escrita em um simples registrador, código 6
  12:uc_libc_dev/protocol/modbus/modbus_master.c ****  * 	 Escrita em muitos registradores, código 16
  13:uc_libc_dev/protocol/modbus/modbus_master.c ****  *
  14:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Os escravos somente capturam as mensagens quando o barramento serial fique em silencio no minimo
  15:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Logo, o timeout do mestre na espera de uma resposta de um escravo deve ser superior a 5ms.
  16:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Geralmente usamos 3 segundos.
  17:uc_libc_dev/protocol/modbus/modbus_master.c ****  *
  18:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Os endereços dos registradores devem ser passados pelos seus valores reais e não por valores enu
  19:uc_libc_dev/protocol/modbus/modbus_master.c ****  *  ou seja, valores de 0 a N.
  20:uc_libc_dev/protocol/modbus/modbus_master.c ****  *
  21:uc_libc_dev/protocol/modbus/modbus_master.c ****  * Para detalhes do protocolo consunte o documento D:\meus_conhecimentos\_devices_misc__\modbus\res
  22:uc_libc_dev/protocol/modbus/modbus_master.c ****  *
  23:uc_libc_dev/protocol/modbus/modbus_master.c ****  * */
  24:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  25:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  26:uc_libc_dev/protocol/modbus/modbus_master.c **** #include "modbus_master.h"
  27:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  28:uc_libc_dev/protocol/modbus/modbus_master.c **** #if (MODBUSM_USE_DEBUG == pdON)
  29:uc_libc_dev/protocol/modbus/modbus_master.c **** #if defined(LINUX)
  30:uc_libc_dev/protocol/modbus/modbus_master.c **** #include <stdio.h>
  31:uc_libc_dev/protocol/modbus/modbus_master.c **** #define modbus_printf printf
  32:uc_libc_dev/protocol/modbus/modbus_master.c **** #else
  33:uc_libc_dev/protocol/modbus/modbus_master.c **** #include "stdio_uc.h"
  34:uc_libc_dev/protocol/modbus/modbus_master.c **** #define modbus_printf plognp
  35:uc_libc_dev/protocol/modbus/modbus_master.c **** #endif
  36:uc_libc_dev/protocol/modbus/modbus_master.c **** #endif
  37:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  38:uc_libc_dev/protocol/modbus/modbus_master.c **** typedef struct {
  39:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int (*ps)(u8 *buffer, u16 count); // Ponteiro da função para envio de bytes
  40:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int (*gc)(u8 *ch);				// Ponteiro da função para recebimento de bytes
  41:uc_libc_dev/protocol/modbus/modbus_master.c **** 	void(*flushRX)(void);				// Ponteiro da função para limpar os buffers de recepção
  42:uc_libc_dev/protocol/modbus/modbus_master.c **** 	uint timeout; 						// Tempo de espera pela resposta do escravo após envio de um comando
  43:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  44:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// vars aux para comunicação atual
  45:uc_libc_dev/protocol/modbus/modbus_master.c **** 	u8 querie[256];						// Buffer aux de transmissão e recepção de dados
  46:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int slaveID;						// Endereço do escravo alvo no barramento para troca de dados
  47:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int cmd;							// Comando (função) solicitado
  48:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int waitResponse;					// Sinaliza para esperar uma resposta após envio de um comando para o escrav
  49:uc_libc_dev/protocol/modbus/modbus_master.c **** 	volatile uint tout;					// Conta o tempo na espera da resposta do escravo
  50:uc_libc_dev/protocol/modbus/modbus_master.c **** 	volatile uint timeDataIn; 			// Conta quanto tempo o dado é recebido do escravo. se o bus ficar em
  51:uc_libc_dev/protocol/modbus/modbus_master.c **** 		#define modbusTIME_DATE_IN 200 // 200ms
  52:uc_libc_dev/protocol/modbus/modbus_master.c **** 	u16* regs;							// Ponteiro dos registradores envolvido na troca de dados
  53:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int len;							// Tamanho do ponteiro
  54:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int addr;							// Endereço do registrador para ser gravado um valor
  55:uc_libc_dev/protocol/modbus/modbus_master.c **** 	u16 value;							// Valor a ser gravado no registrador
  56:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int sts;							// Status da comunicação com o escravo
  57:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// pdPASS ou >1: Comunicação feita com sucesso
  58:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_BUFFER_OVERFLOW: Estourou o tamanho do buffer modbus
  59:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_LENPACKET: Tamanho errado do pacote de resposta do escravo
  60:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_CRC: Houve erro de CRC na resposta do escravo
  61:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_TIMEOUT: Passou o tenpo da espera pela resposta do escravo
  62:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_BUSY: Sinaliza que o gerenciador está no processo de comunicação com o escr
  63:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_TX: Erro no envio de bytes ao escravo
  64:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_ID: O ID do escravo na sua resposta do escravo não bate com o ID do escravo
  65:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_ADDR: O endereço do registrador a ser gravado no escravo é inválido
  66:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_VALUE: Valor escrito no registrador do escravo não bate com o valor enviado
  67:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_CMD: O comando (função) do pacote de recebimento do escravo não bate com o 
  68:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_EXCEPTION: Sinaliza que o escravo enviou uma exceção, consultar status
  69:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// errMODBUS_LEN: O tamanho do pacote recebido do escravo não confere ao esperado
  70:uc_libc_dev/protocol/modbus/modbus_master.c **** 	uint exception;						// Código de exceção do modbus caso for emitido
  71:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// modbusNO_ERROR: Sem erro de exceção
  72:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// modbusILLEGAL_FUNCTION: 		O escravo recebeu uma função que não foi implementada ou nã
  73:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// modbusILLEGAL_DATA_ADDRESS: O escravo precisou acessar um endereço inexistente.
  74:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// modbusILLEGAL_DATA_VALUE:  O valor contido no campo de dado não é permitido pelo escr
  75:uc_libc_dev/protocol/modbus/modbus_master.c **** 											// modbusSLAVE_DEVICE_FAILURE: Um irrecuperável erro ocorreu enquanto o escravo estava t
  76:uc_libc_dev/protocol/modbus/modbus_master.c **** } modbusMaster_t;
  77:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  78:uc_libc_dev/protocol/modbus/modbus_master.c **** static modbusMaster_t modbus;
  79:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ValidatePacket(void);
  80:uc_libc_dev/protocol/modbus/modbus_master.c **** static int GetPacket (void);
  81:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ProcessCmd3(void);
  82:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ProcessCmd6(void);
  83:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ProcessCmd16(void);
  84:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  85:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
  86:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterInit
  87:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Inicializa o protocolo modbus no modo mestre
  88:uc_libc_dev/protocol/modbus/modbus_master.c **** // Parametros:	puts_func:	Ponteiro da função de transmissão serial
  89:uc_libc_dev/protocol/modbus/modbus_master.c **** //				getc_func:	Ponteiro da função de recepção de dados
  90:uc_libc_dev/protocol/modbus/modbus_master.c **** //				byte_available_func: Ponteiro da função para verificar se há dados no buffer de recepção seri
  91:uc_libc_dev/protocol/modbus/modbus_master.c **** //				flushRX_func: Ponteiro da função que limpar os buffers seriais
  92:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		Nada
  93:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
  94:uc_libc_dev/protocol/modbus/modbus_master.c **** // ATENÇÃO: O tamanho do buffers de recepção e transmissão deve ter no mínimo o frame do modbus, re
  95:uc_libc_dev/protocol/modbus/modbus_master.c **** // se usar rs485 tem que ter cuidado para fazer a inversão do barramento. exemplo
  96:uc_libc_dev/protocol/modbus/modbus_master.c **** //		int uart_PutString(u8* buffer, u16 count) {
  97:uc_libc_dev/protocol/modbus/modbus_master.c **** //			rs485_ENTX_ON = rs485_ENTX;
  98:uc_libc_dev/protocol/modbus/modbus_master.c **** //			int ret = uart1_WriteTx(buffer, count);
  99:uc_libc_dev/protocol/modbus/modbus_master.c **** //			while (!uart1_EmptyTx()); // Vamos esperar que o serial envie a mensagem
 100:uc_libc_dev/protocol/modbus/modbus_master.c **** //			rs485_ENTX_OFF = rs485_ENTX;
 101:uc_libc_dev/protocol/modbus/modbus_master.c **** //			return ret;
 102:uc_libc_dev/protocol/modbus/modbus_master.c **** //		}
 103:uc_libc_dev/protocol/modbus/modbus_master.c **** void modbus_MasterInit(
 104:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int(*puts_func)(u8* buffer, u16 count),
 105:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int(*getc_func)(u8* ch),
 106:uc_libc_dev/protocol/modbus/modbus_master.c **** 	void(*flushRX_func)(void)
 107:uc_libc_dev/protocol/modbus/modbus_master.c **** ) {
 108:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.ps = puts_func;
 109:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.gc = getc_func;
 110:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.flushRX = flushRX_func;
 111:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 112:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.slaveID = 0;
 113:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 0;
 114:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = 0;
 115:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.regs = NULL;
 116:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.len = 0;
 117:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.waitResponse = pdFALSE;
 118:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.exception = modbusNO_ERROR;
 119:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.tout = 0;
 120:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.timeDataIn = modbusTIME_DATE_IN;
 121:uc_libc_dev/protocol/modbus/modbus_master.c ****     #if (MODBUSM_USE_DEBUG == pdON)
 122:uc_libc_dev/protocol/modbus/modbus_master.c ****    	modbus_printf("modbusM: INIT"CMD_TERMINATOR);
 123:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#endif
 124:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 125:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 126:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 127:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterTimeout
 128:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Determina o tempo de timeout na espera da resposta do escravo
 129:uc_libc_dev/protocol/modbus/modbus_master.c **** // Parametro:	timeout:  Tempo de espera pela resposta do escravo após envio de um comando
 130:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		Nada
 131:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 132:uc_libc_dev/protocol/modbus/modbus_master.c **** // Exemplo para readregs_func:	modbus_MasterTimeout(3000); timeout = 3000 (3 segundos)
 133:uc_libc_dev/protocol/modbus/modbus_master.c **** void modbus_MasterTimeout(uint timeout) {
 134:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.timeout = timeout;
 135:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 136:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 137:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 138:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterReadStatus
 139:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Retorna com status da comunicação modbus com o escravo
 140:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS ou >1: Comunicação feita com sucesso
 141:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_BUSY: Sinaliza que o gerenciador está no processo de comunicação com o escravo
 142:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_BUFFER_OVERFLOW: Estourou o tamanho do buffer modbus
 143:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_LENPACKET: Tamanho errado do pacote de resposta do escravo
 144:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_CRC: Houve erro de CRC na resposta do escravo
 145:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_TIMEOUT: Passou o tenpo da espera pela resposta do escravo
 146:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_TX: Erro no envio de bytes ao escravo
 147:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ID: O ID do escravo na sua resposta do escravo não bate com o ID do escravo na soli
 148:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_CMD: O comando (função) do pacote de recebimento do escravo não bate com o comando 
 149:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_EXCEPTION: Sinaliza que o escravo enviou uma exceção, consultar status
 150:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_LEN
 151:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 152:uc_libc_dev/protocol/modbus/modbus_master.c **** int modbus_MasterReadStatus(void) {
 153:uc_libc_dev/protocol/modbus/modbus_master.c **** 	return modbus.sts;
 154:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 155:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 156:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 157:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterReadException
 158:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Retorna com exceção ocorrinda na comunicação modbus com o escravo
 159:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna: 	modbusNO_ERROR: Sem erro de exceção
 160:uc_libc_dev/protocol/modbus/modbus_master.c **** // 				modbusILLEGAL_FUNCTION: O escravo recebeu uma função que não foi implementada ou não foi hab
 161:uc_libc_dev/protocol/modbus/modbus_master.c **** // 				modbusILLEGAL_DATA_ADDRESS: O escravo precisou acessar um endereço inexistente.
 162:uc_libc_dev/protocol/modbus/modbus_master.c **** // 				modbusILLEGAL_DATA_VALUE: O valor contido no campo de dado não é permitido pelo escravo. Ist
 163:uc_libc_dev/protocol/modbus/modbus_master.c **** // 				modbusSLAVE_DEVICE_FAILURE: Um irrecuperável erro ocorreu enquanto o escravo estava tentando
 164:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 165:uc_libc_dev/protocol/modbus/modbus_master.c **** int modbus_MasterReadException(void) {
 166:uc_libc_dev/protocol/modbus/modbus_master.c **** 	return modbus.exception;
 167:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 168:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 169:uc_libc_dev/protocol/modbus/modbus_master.c **** // ################################################################################################
 170:uc_libc_dev/protocol/modbus/modbus_master.c **** // AUX
 171:uc_libc_dev/protocol/modbus/modbus_master.c **** // ################################################################################################
 172:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 173:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 174:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		ValidatePacket
 175:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Valida o pacote recebido, checa se o pacote recebido vem do escravo alvo, checa se o
 176:uc_libc_dev/protocol/modbus/modbus_master.c **** //				Verifica se o escravo mandou algum código de exceção
 177:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna: 	pdPASS se o pacote é válido
 178:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ID: O ID do escravo na sua resposta do escravo não bate com o ID do escravo na soli
 179:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_CMD: O comando (função) do pacote de recebimento do escravo não bate com o comando 
 180:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_EXCEPTION: Sinaliza que o escravo enviou uma exceção, consultar status
 181:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 182:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ValidatePacket(void) {
  27              		.loc 1 182 0
  28              		.cfi_startproc
  29              		@ args = 0, pretend = 0, frame = 0
  30              		@ frame_needed = 0, uses_anonymous_args = 0
  31              		@ link register save eliminated.
 183:uc_libc_dev/protocol/modbus/modbus_master.c ****     // checar se o ID do escravo é o mesmo enviado
 184:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.querie[0] != modbus.slaveID)
  32              		.loc 1 184 0
  33 0000 0E4B     		ldr	r3, .L7
  34 0002 197C     		ldrb	r1, [r3, #16]	@ zero_extendqisi2
  35 0004 D3F81021 		ldr	r2, [r3, #272]
  36 0008 9142     		cmp	r1, r2
  37 000a 0ED1     		bne	.L3
 185:uc_libc_dev/protocol/modbus/modbus_master.c **** 		return errMODBUS_ID;
 186:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 187:uc_libc_dev/protocol/modbus/modbus_master.c **** 	 // checar se a função é a mesma enviada
 188:uc_libc_dev/protocol/modbus/modbus_master.c ****     if ((modbus.querie[1] & 0x7f) != modbus.cmd)
  38              		.loc 1 188 0
  39 000c 5A7C     		ldrb	r2, [r3, #17]	@ zero_extendqisi2
  40 000e D3F81411 		ldr	r1, [r3, #276]
  41 0012 02F07F00 		and	r0, r2, #127
  42 0016 8842     		cmp	r0, r1
  43 0018 0AD1     		bne	.L4
 189:uc_libc_dev/protocol/modbus/modbus_master.c ****         return errMODBUS_CMD;
 190:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 191:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// checa se o escravo mandou algum erro de exceção
 192:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if ((modbus.querie[1] & 0x80) > 0) {
  44              		.loc 1 192 0
  45 001a 1206     		lsls	r2, r2, #24
  46 001c 0BD5     		bpl	.L5
 193:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.exception = modbus.querie[2];
  47              		.loc 1 193 0
  48 001e 9A7C     		ldrb	r2, [r3, #18]	@ zero_extendqisi2
 194:uc_libc_dev/protocol/modbus/modbus_master.c ****         return errMODBUS_EXCEPTION;
  49              		.loc 1 194 0
  50 0020 6FF08100 		mvn	r0, #129
 193:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.exception = modbus.querie[2];
  51              		.loc 1 193 0
  52 0024 C3F83821 		str	r2, [r3, #312]
  53              		.loc 1 194 0
  54 0028 7047     		bx	lr
  55              	.L3:
 185:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  56              		.loc 1 185 0
  57 002a 6FF07E00 		mvn	r0, #126
  58 002e 7047     		bx	lr
  59              	.L4:
 189:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  60              		.loc 1 189 0
  61 0030 6FF08000 		mvn	r0, #128
  62 0034 7047     		bx	lr
  63              	.L5:
 195:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 196:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 197:uc_libc_dev/protocol/modbus/modbus_master.c **** 	return pdPASS;
  64              		.loc 1 197 0
  65 0036 0120     		movs	r0, #1
 198:uc_libc_dev/protocol/modbus/modbus_master.c **** }
  66              		.loc 1 198 0
  67 0038 7047     		bx	lr
  68              	.L8:
  69 003a 00BF     		.align	2
  70              	.L7:
  71 003c 00000000 		.word	.LANCHOR0
  72              		.cfi_endproc
  73              	.LFE4:
  75              		.section	.text.modbus_MasterInit,"ax",%progbits
  76              		.align	1
  77              		.global	modbus_MasterInit
  78              		.thumb
  79              		.thumb_func
  81              	modbus_MasterInit:
  82              	.LFB0:
 107:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.ps = puts_func;
  83              		.loc 1 107 0
  84              		.cfi_startproc
  85              		@ args = 0, pretend = 0, frame = 0
  86              		@ frame_needed = 0, uses_anonymous_args = 0
  87              		@ link register save eliminated.
  88              	.LVL0:
 108:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.gc = getc_func;
  89              		.loc 1 108 0
  90 0000 0B4B     		ldr	r3, .L10
 110:uc_libc_dev/protocol/modbus/modbus_master.c **** 
  91              		.loc 1 110 0
  92 0002 83E80700 		stmia	r3, {r0, r1, r2}
 112:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 0;
  93              		.loc 1 112 0
  94 0006 0022     		movs	r2, #0
  95              	.LVL1:
 119:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.timeDataIn = modbusTIME_DATE_IN;
  96              		.loc 1 119 0
  97 0008 C3F81C21 		str	r2, [r3, #284]
 112:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 0;
  98              		.loc 1 112 0
  99 000c C3F81021 		str	r2, [r3, #272]
 113:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = 0;
 100              		.loc 1 113 0
 101 0010 C3F81421 		str	r2, [r3, #276]
 114:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.regs = NULL;
 102              		.loc 1 114 0
 103 0014 C3F83421 		str	r2, [r3, #308]
 115:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.len = 0;
 104              		.loc 1 115 0
 105 0018 C3F82421 		str	r2, [r3, #292]
 116:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.waitResponse = pdFALSE;
 106              		.loc 1 116 0
 107 001c C3F82821 		str	r2, [r3, #296]
 117:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.exception = modbusNO_ERROR;
 108              		.loc 1 117 0
 109 0020 C3F81821 		str	r2, [r3, #280]
 118:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.tout = 0;
 110              		.loc 1 118 0
 111 0024 C3F83821 		str	r2, [r3, #312]
 120:uc_libc_dev/protocol/modbus/modbus_master.c ****     #if (MODBUSM_USE_DEBUG == pdON)
 112              		.loc 1 120 0
 113 0028 C822     		movs	r2, #200
 114 002a C3F82021 		str	r2, [r3, #288]
 115 002e 7047     		bx	lr
 116              	.L11:
 117              		.align	2
 118              	.L10:
 119 0030 00000000 		.word	.LANCHOR0
 120              		.cfi_endproc
 121              	.LFE0:
 123              		.section	.text.modbus_MasterTimeout,"ax",%progbits
 124              		.align	1
 125              		.global	modbus_MasterTimeout
 126              		.thumb
 127              		.thumb_func
 129              	modbus_MasterTimeout:
 130              	.LFB1:
 133:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.timeout = timeout;
 131              		.loc 1 133 0
 132              		.cfi_startproc
 133              		@ args = 0, pretend = 0, frame = 0
 134              		@ frame_needed = 0, uses_anonymous_args = 0
 135              		@ link register save eliminated.
 136              	.LVL2:
 134:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 137              		.loc 1 134 0
 138 0000 014B     		ldr	r3, .L13
 139 0002 D860     		str	r0, [r3, #12]
 140 0004 7047     		bx	lr
 141              	.L14:
 142 0006 00BF     		.align	2
 143              	.L13:
 144 0008 00000000 		.word	.LANCHOR0
 145              		.cfi_endproc
 146              	.LFE1:
 148              		.section	.text.modbus_MasterReadStatus,"ax",%progbits
 149              		.align	1
 150              		.global	modbus_MasterReadStatus
 151              		.thumb
 152              		.thumb_func
 154              	modbus_MasterReadStatus:
 155              	.LFB2:
 152:uc_libc_dev/protocol/modbus/modbus_master.c **** 	return modbus.sts;
 156              		.loc 1 152 0
 157              		.cfi_startproc
 158              		@ args = 0, pretend = 0, frame = 0
 159              		@ frame_needed = 0, uses_anonymous_args = 0
 160              		@ link register save eliminated.
 154:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 161              		.loc 1 154 0
 162 0000 014B     		ldr	r3, .L16
 163 0002 D3F83401 		ldr	r0, [r3, #308]
 164 0006 7047     		bx	lr
 165              	.L17:
 166              		.align	2
 167              	.L16:
 168 0008 00000000 		.word	.LANCHOR0
 169              		.cfi_endproc
 170              	.LFE2:
 172              		.section	.text.modbus_MasterReadException,"ax",%progbits
 173              		.align	1
 174              		.global	modbus_MasterReadException
 175              		.thumb
 176              		.thumb_func
 178              	modbus_MasterReadException:
 179              	.LFB3:
 165:uc_libc_dev/protocol/modbus/modbus_master.c **** 	return modbus.exception;
 180              		.loc 1 165 0
 181              		.cfi_startproc
 182              		@ args = 0, pretend = 0, frame = 0
 183              		@ frame_needed = 0, uses_anonymous_args = 0
 184              		@ link register save eliminated.
 167:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 185              		.loc 1 167 0
 186 0000 014B     		ldr	r3, .L19
 187 0002 D3F83801 		ldr	r0, [r3, #312]
 188 0006 7047     		bx	lr
 189              	.L20:
 190              		.align	2
 191              	.L19:
 192 0008 00000000 		.word	.LANCHOR0
 193              		.cfi_endproc
 194              	.LFE3:
 196              		.section	.text.modbus_MasterReadRegisters,"ax",%progbits
 197              		.align	1
 198              		.global	modbus_MasterReadRegisters
 199              		.thumb
 200              		.thumb_func
 202              	modbus_MasterReadRegisters:
 203              	.LFB9:
 199:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 200:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 201:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		GetPacket
 202:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Se o gerenciador estiver esperando pela uma resposta do escravo o mesmo fica esperan
 203:uc_libc_dev/protocol/modbus/modbus_master.c **** //				na medida que os dados vão sendo recebiso serão adicionados no buffer.
 204:uc_libc_dev/protocol/modbus/modbus_master.c **** //				Uma vez recebido todos os dados o mesmo é submetido ao teste CRC
 205:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna: 	pdPASS: Pacote recebido com sucesso
 206:uc_libc_dev/protocol/modbus/modbus_master.c **** //				0: Não está esperando pela resposta do escravo
 207:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_BUFFER_OVERFLOW: Estourou o tamanho do buffer modbus
 208:uc_libc_dev/protocol/modbus/modbus_master.c **** //  			errMODBUS_LENPACKET: Tamanho errado do pacote de resposta do escravo
 209:uc_libc_dev/protocol/modbus/modbus_master.c **** //  			errMODBUS_CRC: Houve erro de CRC na resposta do escravo
 210:uc_libc_dev/protocol/modbus/modbus_master.c **** //  			errMODBUS_TIMEOUT: Passou o tenpo da espera pela resposta do escravo
 211:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 212:uc_libc_dev/protocol/modbus/modbus_master.c **** static int GetPacket (void) {
 213:uc_libc_dev/protocol/modbus/modbus_master.c **** 	static int len = 0;
 214:uc_libc_dev/protocol/modbus/modbus_master.c ****     static int firstByte = pdTRUE;
 215:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 216:uc_libc_dev/protocol/modbus/modbus_master.c ****     u8 dat;
 217:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 218:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (!modbus.waitResponse) {
 219:uc_libc_dev/protocol/modbus/modbus_master.c **** 		len = 0;
 220:uc_libc_dev/protocol/modbus/modbus_master.c **** 		firstByte = pdTRUE;
 221:uc_libc_dev/protocol/modbus/modbus_master.c **** 		modbus.tout = modbus.timeout;
 222:uc_libc_dev/protocol/modbus/modbus_master.c **** 		return 0;
 223:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 224:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 225:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.gc(&dat) == pdPASS) { 			// Checa se recebeu dados
 226:uc_libc_dev/protocol/modbus/modbus_master.c ****         #if (MODBUSM_USE_DEBUG == pdON)
 227:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus_printf("modbusM: getp dat 0x%x [%c] len %d"CMD_TERMINATOR, dat, dat, len);
 228:uc_libc_dev/protocol/modbus/modbus_master.c ****         #endif
 229:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 230:uc_libc_dev/protocol/modbus/modbus_master.c **** 		firstByte = pdFALSE;                    // Sinaliza que não é o mais o primeiro byte
 231:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 232:uc_libc_dev/protocol/modbus/modbus_master.c ****     	if (len >= 256) return errMODBUS_BUFFER_OVERFLOW;
 233:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.querie[len++] = dat;			// Adiciona o dado no buffer e aponta para o próximo indice d
 234:uc_libc_dev/protocol/modbus/modbus_master.c **** 		modbus.timeDataIn = modbusTIME_DATE_IN;			// Tempo de espera de recebimento de dados do escravo
 235:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 236:uc_libc_dev/protocol/modbus/modbus_master.c ****  	// se não há mais bytes no buffer serial em um determinado tempo é porque é fim de transmissão
 237:uc_libc_dev/protocol/modbus/modbus_master.c ****  		// valor 10 funciona bem entre 2400 a 115200 bps. Valor 5 funcionou bem com 57600 e 115200
 238:uc_libc_dev/protocol/modbus/modbus_master.c ****         // para boudrate menores pode ser que devemos aumetar esse valor.
 239:uc_libc_dev/protocol/modbus/modbus_master.c ****         // Recomendo fazer uma macro associado ao baudrate da serial
 240:uc_libc_dev/protocol/modbus/modbus_master.c ****  	} else if (modbus.timeDataIn == 0) {
 241:uc_libc_dev/protocol/modbus/modbus_master.c ****         if (!firstByte) {
 242:uc_libc_dev/protocol/modbus/modbus_master.c ****         	if (len < 3) {
 243:uc_libc_dev/protocol/modbus/modbus_master.c **** 		        #if (MODBUSM_USE_DEBUG == pdON)
 244:uc_libc_dev/protocol/modbus/modbus_master.c ****         		modbus_printf("modbusM: err len %d"CMD_TERMINATOR, len);
 245:uc_libc_dev/protocol/modbus/modbus_master.c ****         		#endif
 246:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 247:uc_libc_dev/protocol/modbus/modbus_master.c ****         		return errMODBUS_LENPACKET;
 248:uc_libc_dev/protocol/modbus/modbus_master.c ****         	}
 249:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 250:uc_libc_dev/protocol/modbus/modbus_master.c ****             // Vamos pegar o pacote deste buffer e calcular e verificar a legitimidade
 251:uc_libc_dev/protocol/modbus/modbus_master.c ****             // Calcular CRC do pacote e comparar
 252:uc_libc_dev/protocol/modbus/modbus_master.c ****             u16 crc_calc = crc16_MODBUS(modbus.querie, len-2);
 253:uc_libc_dev/protocol/modbus/modbus_master.c ****             u16 crc = (modbus.querie[len-1] << 8 ) | modbus.querie[len-2];
 254:uc_libc_dev/protocol/modbus/modbus_master.c ****             if (crc != crc_calc) {
 255:uc_libc_dev/protocol/modbus/modbus_master.c **** 		        #if (MODBUSM_USE_DEBUG == pdON)
 256:uc_libc_dev/protocol/modbus/modbus_master.c ****         		modbus_printf("modbusM: err crc 0x%x calc 0x%x len %d"CMD_TERMINATOR, crc, crc_calc, len)
 257:uc_libc_dev/protocol/modbus/modbus_master.c ****         		#endif
 258:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 259:uc_libc_dev/protocol/modbus/modbus_master.c ****             	return errMODBUS_CRC;
 260:uc_libc_dev/protocol/modbus/modbus_master.c ****             } else return pdPASS;
 261:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 262:uc_libc_dev/protocol/modbus/modbus_master.c ****         // se ainda não recebemos o primeiro byte após um tempo vamos cancelar
 263:uc_libc_dev/protocol/modbus/modbus_master.c ****         } else if (modbus.tout == 0) {
 264:uc_libc_dev/protocol/modbus/modbus_master.c **** 			#if (MODBUSM_USE_DEBUG == pdON)
 265:uc_libc_dev/protocol/modbus/modbus_master.c ****         	modbus_printf("modbusM: err timeout"CMD_TERMINATOR);
 266:uc_libc_dev/protocol/modbus/modbus_master.c ****         	#endif
 267:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 268:uc_libc_dev/protocol/modbus/modbus_master.c **** 			return errMODBUS_TIMEOUT;
 269:uc_libc_dev/protocol/modbus/modbus_master.c ****         }
 270:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 271:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 272:uc_libc_dev/protocol/modbus/modbus_master.c **** 	return 0;
 273:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 274:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 275:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 276:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		ProcessCmd3
 277:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Processa a resposta do escravo mediante requisição do comando 3
 278:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS sinalizando que foi pego a resposta do escravo com sucesso
 279:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ID: O ID do escravo na sua resposta do escravo não bate com o ID do escravo na soli
 280:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_CMD: O comando (função) do pacote de recebimento do escravo não bate com o comando 
 281:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_EXCEPTION: Sinaliza que o escravo enviou uma exceção, consultar status
 282:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_LEN: O tamanho do pacote recebido do escravo não confere ao esperado
 283:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 284:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ProcessCmd3(void) {
 285:uc_libc_dev/protocol/modbus/modbus_master.c ****    	// Checa se este pacote é mesmo do escravo solicitado
 286:uc_libc_dev/protocol/modbus/modbus_master.c ****    	int ret = ValidatePacket(); // retorna pdPASS	errMODBUS_ID	errMODBUS_CMD errMODBUS_EXCEPTION
 287:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret != pdPASS ) return ret;
 288:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 289:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 0; // sinaliza que não estamos mais operando nenhum comando
 290:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 291:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 292:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// captura a quantidade de bytes recebidos
 293:uc_libc_dev/protocol/modbus/modbus_master.c ****    	int countBytes = modbus.querie[2];
 294:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (2*modbus.len != countBytes) return errMODBUS_LEN;
 295:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 296:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// Tirar os valores dos registradores do bufferin para o buffer da aplicação
 297:uc_libc_dev/protocol/modbus/modbus_master.c ****    	int x; for(x=0; x<modbus.len;x++)
 298:uc_libc_dev/protocol/modbus/modbus_master.c ****        	*modbus.regs++ = (modbus.querie[2*x+3] << 8) | (modbus.querie[2*x+4]);
 299:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 300:uc_libc_dev/protocol/modbus/modbus_master.c ****   	return pdPASS;
 301:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 302:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 303:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 304:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		ProcessCmd6
 305:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Processa a resposta do escravo mediante requisição do comando 6
 306:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS sinalizando que foi pego a resposta do escravo com sucesso
 307:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ID: O ID do escravo na sua resposta do escravo não bate com o ID do escravo na soli
 308:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ADDR: O endereço do registrador a ser gravado no escravo é inválido
 309:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_CMD: O comando (função) do pacote de recebimento do escravo não bate com o comando 
 310:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_EXCEPTION: Sinaliza que o escravo enviou uma exceção, consultar status
 311:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_LEN: O tamanho do pacote recebido do escravo não confere ao esperado
 312:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 313:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ProcessCmd6(void) {
 314:uc_libc_dev/protocol/modbus/modbus_master.c ****    	// Checa se este pacote é mesmo do escravo solicitado
 315:uc_libc_dev/protocol/modbus/modbus_master.c ****    	int ret = ValidatePacket(); // retorna pdPASS	errMODBUS_ID	errMODBUS_CMD errMODBUS_EXCEPTION
 316:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret != pdPASS ) return ret;
 317:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 318:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 0; // sinaliza que não estamos mais operando nenhum comando
 319:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 320:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 321:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// compara endereço do registrador
 322:uc_libc_dev/protocol/modbus/modbus_master.c ****     int addrComp = (modbus.querie[2] << 8) | (modbus.querie[3]);
 323:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.addr != addrComp)  return errMODBUS_ADDR;
 324:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 325:uc_libc_dev/protocol/modbus/modbus_master.c ****     // compara valor do registrador
 326:uc_libc_dev/protocol/modbus/modbus_master.c ****     u16 valueComp = (modbus.querie[4] << 8) | (modbus.querie[5]);
 327:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.value != valueComp) return errMODBUS_VALUE;
 328:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 329:uc_libc_dev/protocol/modbus/modbus_master.c ****   	return pdPASS;
 330:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 331:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 332:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 333:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		ProcessCmd16
 334:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Processa a resposta do escravo mediante requisição do comando 16
 335:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS sinalizando que foi pego a resposta do escravo com sucesso
 336:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ID: O ID do escravo na sua resposta do escravo não bate com o ID do escravo na soli
 337:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_ADDR: O endereço do registrador a ser gravado no escravo é inválido
 338:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_CMD: O comando (função) do pacote de recebimento do escravo não bate com o comando 
 339:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_EXCEPTION: Sinaliza que o escravo enviou uma exceção, consultar status
 340:uc_libc_dev/protocol/modbus/modbus_master.c **** //				errMODBUS_LEN: O tamanho do pacote recebido do escravo não confere ao esperado
 341:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 342:uc_libc_dev/protocol/modbus/modbus_master.c **** static int ProcessCmd16(void) {
 343:uc_libc_dev/protocol/modbus/modbus_master.c ****    	// Checa se este pacote é mesmo do escravo solicitado
 344:uc_libc_dev/protocol/modbus/modbus_master.c ****    	int ret = ValidatePacket(); // retorna pdPASS	errMODBUS_ID	errMODBUS_CMD errMODBUS_EXCEPTION
 345:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret != pdPASS ) return ret;
 346:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 347:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 0; // sinaliza que não estamos mais operando nenhum comando
 348:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 349:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 350:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// compara endereço do registrador
 351:uc_libc_dev/protocol/modbus/modbus_master.c ****     int cmp = (modbus.querie[2] << 8) | (modbus.querie[3]);
 352:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.addr != cmp)  return errMODBUS_ADDR;
 353:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 354:uc_libc_dev/protocol/modbus/modbus_master.c ****     // compara a quantidade
 355:uc_libc_dev/protocol/modbus/modbus_master.c ****     cmp = (modbus.querie[4] << 8) | (modbus.querie[5]);
 356:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.len != cmp) return errMODBUS_VALUE;
 357:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 358:uc_libc_dev/protocol/modbus/modbus_master.c ****   	return pdPASS;
 359:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 360:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 361:uc_libc_dev/protocol/modbus/modbus_master.c **** // ################################################################################################
 362:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNCTIONS
 363:uc_libc_dev/protocol/modbus/modbus_master.c **** // ################################################################################################
 364:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 365:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 366:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterReadRegisters
 367:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Envia uma solicitação de leitura de registradores no escravo
 368:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS se enviou a querie com sucesso ao escravo, ou retorna pdFAIL se houve algum err
 369:uc_libc_dev/protocol/modbus/modbus_master.c **** // ATENÇÃO: 	Quando uma querie for enviada com sucesso, ficar monitorando o status da comunicação p
 370:uc_libc_dev/protocol/modbus/modbus_master.c **** //					pdPASS: Avisar ao sistema que a leitura dos registradores foi feita com sucesso e é para cap
 371:uc_libc_dev/protocol/modbus/modbus_master.c **** //					errMODBUS_BUSY: Sinaliza que o gerenciador está no processo de comunicação com o escravo
 372:uc_libc_dev/protocol/modbus/modbus_master.c **** //  				errMODBUS_XXXXX: Notificar ao sistema o tipo de erro e tomar procedimento cabíveis
 373:uc_libc_dev/protocol/modbus/modbus_master.c **** //						sistema deve consultar com a função modbus_MasterReadStatus()
 374:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 375:uc_libc_dev/protocol/modbus/modbus_master.c **** int modbus_MasterReadRegisters(int addrSlave, int addrInit, int len, u16* regs) {
 204              		.loc 1 375 0
 205              		.cfi_startproc
 206              		@ args = 0, pretend = 0, frame = 0
 207              		@ frame_needed = 0, uses_anonymous_args = 0
 208              	.LVL3:
 209 0000 F8B5     		push	{r3, r4, r5, r6, r7, lr}
 210              	.LCFI0:
 211              		.cfi_def_cfa_offset 24
 212              		.cfi_offset 3, -24
 213              		.cfi_offset 4, -20
 214              		.cfi_offset 5, -16
 215              		.cfi_offset 6, -12
 216              		.cfi_offset 7, -8
 217              		.cfi_offset 14, -4
 376:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 218              		.loc 1 376 0
 219 0002 1D4C     		ldr	r4, .L25
 375:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 220              		.loc 1 375 0
 221 0004 0F46     		mov	r7, r1
 222              		.loc 1 376 0
 223 0006 D4F81851 		ldr	r5, [r4, #280]
 375:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 224              		.loc 1 375 0
 225 000a 1646     		mov	r6, r2
 226              		.loc 1 376 0
 227 000c 8DBB     		cbnz	r5, .L24
 377:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 378:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.slaveID = addrSlave;
 379:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 3;
 228              		.loc 1 379 0
 229 000e 0322     		movs	r2, #3
 230              	.LVL4:
 380:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.len = len;
 381:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.regs = regs;
 231              		.loc 1 381 0
 232 0010 C4F82431 		str	r3, [r4, #292]
 382:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = errMODBUS_BUSY;
 233              		.loc 1 382 0
 234 0014 6FF08503 		mvn	r3, #133
 235              	.LVL5:
 379:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.len = len;
 236              		.loc 1 379 0
 237 0018 C4F81421 		str	r2, [r4, #276]
 378:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 3;
 238              		.loc 1 378 0
 239 001c C4F81001 		str	r0, [r4, #272]
 240              		.loc 1 382 0
 241 0020 C4F83431 		str	r3, [r4, #308]
 380:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.regs = regs;
 242              		.loc 1 380 0
 243 0024 C4F82861 		str	r6, [r4, #296]
 383:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 384:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.flushRX(); // limpa os byffers RX da serial
 244              		.loc 1 384 0
 245 0028 A368     		ldr	r3, [r4, #8]
 246 002a 9847     		blx	r3
 247              	.LVL6:
 385:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 386:uc_libc_dev/protocol/modbus/modbus_master.c ****    	// preparar a query
 387:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.querie[0] = modbus.slaveID;
 248              		.loc 1 387 0
 249 002c D4F81031 		ldr	r3, [r4, #272]
 388:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 389:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[2] = (addrInit >> 8) & 0xff;
 390:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[3] = addrInit & 0xff;
 391:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[4] = (len >> 8) & 0xff;
 392:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[5] = len & 0xff;
 393:uc_libc_dev/protocol/modbus/modbus_master.c ****     u16 crc = crc16_MODBUS(modbus.querie, 6);
 250              		.loc 1 393 0
 251 0030 0621     		movs	r1, #6
 387:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 252              		.loc 1 387 0
 253 0032 2374     		strb	r3, [r4, #16]
 388:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 254              		.loc 1 388 0
 255 0034 D4F81431 		ldr	r3, [r4, #276]
 256              		.loc 1 393 0
 257 0038 04F11000 		add	r0, r4, #16
 388:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 258              		.loc 1 388 0
 259 003c 6374     		strb	r3, [r4, #17]
 389:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[3] = addrInit & 0xff;
 260              		.loc 1 389 0
 261 003e 3B12     		asrs	r3, r7, #8
 262 0040 A374     		strb	r3, [r4, #18]
 391:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[5] = len & 0xff;
 263              		.loc 1 391 0
 264 0042 3312     		asrs	r3, r6, #8
 265 0044 2375     		strb	r3, [r4, #20]
 390:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[4] = (len >> 8) & 0xff;
 266              		.loc 1 390 0
 267 0046 E774     		strb	r7, [r4, #19]
 392:uc_libc_dev/protocol/modbus/modbus_master.c ****     u16 crc = crc16_MODBUS(modbus.querie, 6);
 268              		.loc 1 392 0
 269 0048 6675     		strb	r6, [r4, #21]
 270              		.loc 1 393 0
 271 004a FFF7FEFF 		bl	crc16_MODBUS
 272              	.LVL7:
 394:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[6] = crc & 0xff;
 273              		.loc 1 394 0
 274 004e A075     		strb	r0, [r4, #22]
 395:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[7] = (crc >> 8) & 0xff;
 275              		.loc 1 395 0
 276 0050 000A     		lsrs	r0, r0, #8
 277              	.LVL8:
 278 0052 E075     		strb	r0, [r4, #23]
 396:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 397:uc_libc_dev/protocol/modbus/modbus_master.c ****     // enviar a query para o escravo
 398:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.ps(modbus.querie, 8) < 0) {
 279              		.loc 1 398 0
 280 0054 2046     		mov	r0, r4
 281 0056 0821     		movs	r1, #8
 282 0058 50F8103B 		ldr	r3, [r0], #16
 283 005c 9847     		blx	r3
 284              	.LVL9:
 285 005e 0028     		cmp	r0, #0
 399:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.sts = errMODBUS_TX;
 286              		.loc 1 399 0
 287 0060 B5BF     		itete	lt
 288 0062 6FF07A03 		mvnlt	r3, #122
 400:uc_libc_dev/protocol/modbus/modbus_master.c ****         return pdFAIL;
 401:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 402:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 403:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// sinalisa que vamos esperar a resposta do escravo
 404:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.waitResponse = pdTRUE;
 289              		.loc 1 404 0
 290 0066 0125     		movge	r5, #1
 399:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.sts = errMODBUS_TX;
 291              		.loc 1 399 0
 292 0068 C4F83431 		strlt	r3, [r4, #308]
 293              		.loc 1 404 0
 294 006c C4F81851 		strge	r5, [r4, #280]
 405:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 406:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#if (MODBUSM_USE_DEBUG == pdON)
 407:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus_printf("modbusM: TX RR: ");
 408:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int x; for (x=0;x<8;x++) modbus_printf("0x%x ", modbus.querie[x]);
 409:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus_printf(CMD_TERMINATOR);
 410:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#endif
 411:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 412:uc_libc_dev/protocol/modbus/modbus_master.c ****     return pdPASS;
 295              		.loc 1 412 0
 296 0070 00E0     		b	.L22
 297              	.LVL10:
 298              	.L24:
 376:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 299              		.loc 1 376 0
 300 0072 0025     		movs	r5, #0
 301              	.LVL11:
 302              	.L22:
 413:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 303              		.loc 1 413 0
 304 0074 2846     		mov	r0, r5
 305 0076 F8BD     		pop	{r3, r4, r5, r6, r7, pc}
 306              	.LVL12:
 307              	.L26:
 308              		.align	2
 309              	.L25:
 310 0078 00000000 		.word	.LANCHOR0
 311              		.cfi_endproc
 312              	.LFE9:
 314              		.section	.text.modbus_MasterWriteRegister,"ax",%progbits
 315              		.align	1
 316              		.global	modbus_MasterWriteRegister
 317              		.thumb
 318              		.thumb_func
 320              	modbus_MasterWriteRegister:
 321              	.LFB10:
 414:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 415:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 416:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterWriteRegister
 417:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Envia uma solicitação de escrita a um registrador no escravo
 418:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS se enviou a querie com sucesso ao escravo, ou retorna pdFAIL se houve algum err
 419:uc_libc_dev/protocol/modbus/modbus_master.c **** // ATENÇÃO: 	Quando uma querie for enviada com sucesso, ficar monitorando o status da comunicação p
 420:uc_libc_dev/protocol/modbus/modbus_master.c **** //					pdPASS: Avisar ao sistema que a escrita no registrador foi feita com sucesso
 421:uc_libc_dev/protocol/modbus/modbus_master.c **** //					errMODBUS_BUSY: Sinaliza que o gerenciador está no processo de comunicação com o escravo
 422:uc_libc_dev/protocol/modbus/modbus_master.c **** //  				errMODBUS_XXXXX: Notificar ao sistema o tipo de erro e tomar procedimento cabíveis.
 423:uc_libc_dev/protocol/modbus/modbus_master.c **** //						sistema deve consultar com a função modbus_MasterReadStatus()
 424:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 425:uc_libc_dev/protocol/modbus/modbus_master.c **** int modbus_MasterWriteRegister(int addrSlave, int addr, u16 value) {
 322              		.loc 1 425 0
 323              		.cfi_startproc
 324              		@ args = 0, pretend = 0, frame = 0
 325              		@ frame_needed = 0, uses_anonymous_args = 0
 326              	.LVL13:
 327 0000 2DE9F041 		push	{r4, r5, r6, r7, r8, lr}
 328              	.LCFI1:
 329              		.cfi_def_cfa_offset 24
 330              		.cfi_offset 4, -24
 331              		.cfi_offset 5, -20
 332              		.cfi_offset 6, -16
 333              		.cfi_offset 7, -12
 334              		.cfi_offset 8, -8
 335              		.cfi_offset 14, -4
 426:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 336              		.loc 1 426 0
 337 0004 1E4C     		ldr	r4, .L31
 425:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 338              		.loc 1 425 0
 339 0006 0F46     		mov	r7, r1
 340              		.loc 1 426 0
 341 0008 D4F81851 		ldr	r5, [r4, #280]
 425:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 342              		.loc 1 425 0
 343 000c 1646     		mov	r6, r2
 344              		.loc 1 426 0
 345 000e 95BB     		cbnz	r5, .L30
 427:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 428:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.slaveID = addrSlave;
 429:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 6;
 346              		.loc 1 429 0
 347 0010 4FF00608 		mov	r8, #6
 430:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.addr = addr;
 431:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.value = value;
 432:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = errMODBUS_BUSY;
 348              		.loc 1 432 0
 349 0014 6FF08503 		mvn	r3, #133
 431:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = errMODBUS_BUSY;
 350              		.loc 1 431 0
 351 0018 A4F83021 		strh	r2, [r4, #304]	@ movhi
 428:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 6;
 352              		.loc 1 428 0
 353 001c C4F81001 		str	r0, [r4, #272]
 430:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.addr = addr;
 354              		.loc 1 430 0
 355 0020 C4F82C11 		str	r1, [r4, #300]
 356              		.loc 1 432 0
 357 0024 C4F83431 		str	r3, [r4, #308]
 429:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.addr = addr;
 358              		.loc 1 429 0
 359 0028 C4F81481 		str	r8, [r4, #276]
 433:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 434:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.flushRX(); // limpa os byffers RX da serial
 360              		.loc 1 434 0
 361 002c A368     		ldr	r3, [r4, #8]
 362 002e 9847     		blx	r3
 363              	.LVL14:
 435:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 436:uc_libc_dev/protocol/modbus/modbus_master.c ****     // preparar a query
 437:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[0] = modbus.slaveID;
 364              		.loc 1 437 0
 365 0030 D4F81031 		ldr	r3, [r4, #272]
 438:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 439:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[2] = (addr >> 8) & 0xff;
 440:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[3] = addr & 0xff;
 441:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[4] = (value >> 8) & 0xff;
 442:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[5] = value & 0xff;
 443:uc_libc_dev/protocol/modbus/modbus_master.c ****     u16 crc = crc16_MODBUS(modbus.querie, 6);
 366              		.loc 1 443 0
 367 0034 4146     		mov	r1, r8
 437:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 368              		.loc 1 437 0
 369 0036 2374     		strb	r3, [r4, #16]
 438:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 370              		.loc 1 438 0
 371 0038 D4F81431 		ldr	r3, [r4, #276]
 372              		.loc 1 443 0
 373 003c 04F11000 		add	r0, r4, #16
 438:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 374              		.loc 1 438 0
 375 0040 6374     		strb	r3, [r4, #17]
 439:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[3] = addr & 0xff;
 376              		.loc 1 439 0
 377 0042 3B12     		asrs	r3, r7, #8
 378 0044 A374     		strb	r3, [r4, #18]
 441:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[5] = value & 0xff;
 379              		.loc 1 441 0
 380 0046 330A     		lsrs	r3, r6, #8
 381 0048 2375     		strb	r3, [r4, #20]
 440:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[4] = (value >> 8) & 0xff;
 382              		.loc 1 440 0
 383 004a E774     		strb	r7, [r4, #19]
 442:uc_libc_dev/protocol/modbus/modbus_master.c ****     u16 crc = crc16_MODBUS(modbus.querie, 6);
 384              		.loc 1 442 0
 385 004c 6675     		strb	r6, [r4, #21]
 386              		.loc 1 443 0
 387 004e FFF7FEFF 		bl	crc16_MODBUS
 388              	.LVL15:
 444:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[6] = crc & 0xff;
 389              		.loc 1 444 0
 390 0052 A075     		strb	r0, [r4, #22]
 445:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[7] = (crc >> 8) & 0xff;
 391              		.loc 1 445 0
 392 0054 000A     		lsrs	r0, r0, #8
 393              	.LVL16:
 394 0056 E075     		strb	r0, [r4, #23]
 446:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 447:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// enviar a query para o escravo
 448:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.ps(modbus.querie, 8) < 0) {
 395              		.loc 1 448 0
 396 0058 2046     		mov	r0, r4
 397 005a 0821     		movs	r1, #8
 398 005c 50F8103B 		ldr	r3, [r0], #16
 399 0060 9847     		blx	r3
 400              	.LVL17:
 401 0062 0028     		cmp	r0, #0
 449:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.sts = errMODBUS_TX;
 402              		.loc 1 449 0
 403 0064 B5BF     		itete	lt
 404 0066 6FF07A03 		mvnlt	r3, #122
 450:uc_libc_dev/protocol/modbus/modbus_master.c ****         return pdFAIL;
 451:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 452:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 453:uc_libc_dev/protocol/modbus/modbus_master.c **** 	// sinalisa que vamos esperar a resposta do escravo
 454:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.waitResponse = pdTRUE;
 405              		.loc 1 454 0
 406 006a 0125     		movge	r5, #1
 449:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.sts = errMODBUS_TX;
 407              		.loc 1 449 0
 408 006c C4F83431 		strlt	r3, [r4, #308]
 409              		.loc 1 454 0
 410 0070 C4F81851 		strge	r5, [r4, #280]
 455:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 456:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#if (MODBUSM_USE_DEBUG == pdON)
 457:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus_printf("modbusM: TX WR: ");
 458:uc_libc_dev/protocol/modbus/modbus_master.c **** 	int x; for (x=0;x<8;x++) modbus_printf("0x%x ", modbus.querie[x]);
 459:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus_printf(CMD_TERMINATOR);
 460:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#endif
 461:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 462:uc_libc_dev/protocol/modbus/modbus_master.c ****     return pdPASS;
 411              		.loc 1 462 0
 412 0074 00E0     		b	.L28
 413              	.LVL18:
 414              	.L30:
 426:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 415              		.loc 1 426 0
 416 0076 0025     		movs	r5, #0
 417              	.LVL19:
 418              	.L28:
 463:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 419              		.loc 1 463 0
 420 0078 2846     		mov	r0, r5
 421 007a BDE8F081 		pop	{r4, r5, r6, r7, r8, pc}
 422              	.LVL20:
 423              	.L32:
 424 007e 00BF     		.align	2
 425              	.L31:
 426 0080 00000000 		.word	.LANCHOR0
 427              		.cfi_endproc
 428              	.LFE10:
 430              		.section	.text.modbus_MasterWriteRegisters,"ax",%progbits
 431              		.align	1
 432              		.global	modbus_MasterWriteRegisters
 433              		.thumb
 434              		.thumb_func
 436              	modbus_MasterWriteRegisters:
 437              	.LFB11:
 464:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 465:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 466:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterWriteRegisters
 467:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Envia uma solicitação de escrita de registradores no escravo
 468:uc_libc_dev/protocol/modbus/modbus_master.c **** // Retorna:		pdPASS se enviou a querie com sucesso ao escravo, ou retorna pdFAIL se houve algum err
 469:uc_libc_dev/protocol/modbus/modbus_master.c **** // ATENÇÃO: 	Quando uma querie for enviada com sucesso, ficar monitorando o status da comunicação p
 470:uc_libc_dev/protocol/modbus/modbus_master.c **** //					pdPASS: Avisar ao sistema que a escrita no registrador foi feita com sucesso
 471:uc_libc_dev/protocol/modbus/modbus_master.c **** //					errMODBUS_BUSY: Sinaliza que o gerenciador está no processo de comunicação com o escravo
 472:uc_libc_dev/protocol/modbus/modbus_master.c **** //  				errMODBUS_XXXXX: Notificar ao sistema o tipo de erro e tomar procedimento cabíveis.
 473:uc_libc_dev/protocol/modbus/modbus_master.c **** //						sistema deve consultar com a função modbus_MasterReadStatus()
 474:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 475:uc_libc_dev/protocol/modbus/modbus_master.c **** int modbus_MasterWriteRegisters(int addrSlave, int addrInit, int len, u16* regs) {
 438              		.loc 1 475 0
 439              		.cfi_startproc
 440              		@ args = 0, pretend = 0, frame = 0
 441              		@ frame_needed = 0, uses_anonymous_args = 0
 442              	.LVL21:
 443 0000 2DE9F041 		push	{r4, r5, r6, r7, r8, lr}
 444              	.LCFI2:
 445              		.cfi_def_cfa_offset 24
 446              		.cfi_offset 4, -24
 447              		.cfi_offset 5, -20
 448              		.cfi_offset 6, -16
 449              		.cfi_offset 7, -12
 450              		.cfi_offset 8, -8
 451              		.cfi_offset 14, -4
 476:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 452              		.loc 1 476 0
 453 0004 2F4C     		ldr	r4, .L40
 475:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 454              		.loc 1 475 0
 455 0006 8846     		mov	r8, r1
 456              		.loc 1 476 0
 457 0008 D4F81861 		ldr	r6, [r4, #280]
 475:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.waitResponse) return pdFAIL;
 458              		.loc 1 475 0
 459 000c 1546     		mov	r5, r2
 460 000e 1F46     		mov	r7, r3
 461              		.loc 1 476 0
 462 0010 002E     		cmp	r6, #0
 463 0012 53D1     		bne	.L38
 477:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 478:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.slaveID = addrSlave;
 479:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 16;
 464              		.loc 1 479 0
 465 0014 1023     		movs	r3, #16
 466              	.LVL22:
 467 0016 C4F81431 		str	r3, [r4, #276]
 480:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.addr = addrInit;
 481:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.len = len;
 482:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.regs = regs;
 483:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = errMODBUS_BUSY;
 468              		.loc 1 483 0
 469 001a 6FF08503 		mvn	r3, #133
 480:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.addr = addrInit;
 470              		.loc 1 480 0
 471 001e C4F82C11 		str	r1, [r4, #300]
 481:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.regs = regs;
 472              		.loc 1 481 0
 473 0022 C4F82821 		str	r2, [r4, #296]
 474              		.loc 1 483 0
 475 0026 C4F83431 		str	r3, [r4, #308]
 478:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.cmd = 16;
 476              		.loc 1 478 0
 477 002a C4F81001 		str	r0, [r4, #272]
 484:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 485:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.flushRX(); // limpa os byffers RX da serial
 478              		.loc 1 485 0
 479 002e A368     		ldr	r3, [r4, #8]
 482:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.sts = errMODBUS_BUSY;
 480              		.loc 1 482 0
 481 0030 C4F82471 		str	r7, [r4, #292]
 482              		.loc 1 485 0
 483 0034 9847     		blx	r3
 484              	.LVL23:
 486:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 487:uc_libc_dev/protocol/modbus/modbus_master.c ****     // preparar a query
 488:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[0] = modbus.slaveID;
 489:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 490:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[2] = (addrInit >> 8) & 0xff;
 491:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[3] = addrInit & 0xff;
 492:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[4] = (len >> 8) & 0xff;
 493:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[5] = len & 0xff;
 494:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[6] = 2*len;
 495:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 496:uc_libc_dev/protocol/modbus/modbus_master.c ****     int x; for(x=0;x<len;x++) {
 485              		.loc 1 496 0
 486 0036 3146     		mov	r1, r6
 488:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 487              		.loc 1 488 0
 488 0038 D4F81031 		ldr	r3, [r4, #272]
 491:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[4] = (len >> 8) & 0xff;
 489              		.loc 1 491 0
 490 003c 84F81380 		strb	r8, [r4, #19]
 488:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[1] = modbus.cmd;
 491              		.loc 1 488 0
 492 0040 2374     		strb	r3, [r4, #16]
 489:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[2] = (addrInit >> 8) & 0xff;
 493              		.loc 1 489 0
 494 0042 D4F81431 		ldr	r3, [r4, #276]
 495 0046 04F11702 		add	r2, r4, #23
 496 004a 6374     		strb	r3, [r4, #17]
 490:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[3] = addrInit & 0xff;
 497              		.loc 1 490 0
 498 004c 4FEA2823 		asr	r3, r8, #8
 499 0050 A374     		strb	r3, [r4, #18]
 492:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[5] = len & 0xff;
 500              		.loc 1 492 0
 501 0052 2B12     		asrs	r3, r5, #8
 502 0054 2375     		strb	r3, [r4, #20]
 493:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[6] = 2*len;
 503              		.loc 1 493 0
 504 0056 EBB2     		uxtb	r3, r5
 505 0058 6375     		strb	r3, [r4, #21]
 494:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 506              		.loc 1 494 0
 507 005a 5B00     		lsls	r3, r3, #1
 508 005c A375     		strb	r3, [r4, #22]
 509              	.LVL24:
 510 005e BB1E     		subs	r3, r7, #2
 511              	.LVL25:
 512              	.L35:
 513              		.loc 1 496 0 discriminator 1
 514 0060 A942     		cmp	r1, r5
 515 0062 02F10202 		add	r2, r2, #2
 516 0066 09DA     		bge	.L39
 497:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.querie[7+2*x] = *regs >> 8;
 517              		.loc 1 497 0 discriminator 3
 518 0068 33F8020F 		ldrh	r0, [r3, #2]!
 519              	.LVL26:
 496:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.querie[7+2*x] = *regs >> 8;
 520              		.loc 1 496 0 discriminator 3
 521 006c 0131     		adds	r1, r1, #1
 522              	.LVL27:
 523              		.loc 1 497 0 discriminator 3
 524 006e 000A     		lsrs	r0, r0, #8
 525 0070 02F8020C 		strb	r0, [r2, #-2]
 498:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.querie[8+2*x] = *regs & 0xff;
 526              		.loc 1 498 0 discriminator 3
 527 0074 1888     		ldrh	r0, [r3]
 528 0076 02F8010C 		strb	r0, [r2, #-1]
 529              	.LVL28:
 530 007a F1E7     		b	.L35
 531              	.L39:
 499:uc_libc_dev/protocol/modbus/modbus_master.c ****         regs++;
 500:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 501:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 502:uc_libc_dev/protocol/modbus/modbus_master.c ****     u16 crc = crc16_MODBUS(modbus.querie, 7+(2*len));
 532              		.loc 1 502 0
 533 007c 114F     		ldr	r7, .L40
 534 007e 6D00     		lsls	r5, r5, #1
 535              	.LVL29:
 536 0080 05F10708 		add	r8, r5, #7
 537              	.LVL30:
 538 0084 4146     		mov	r1, r8
 539              	.LVL31:
 540 0086 07F11000 		add	r0, r7, #16
 541 008a FFF7FEFF 		bl	crc16_MODBUS
 542              	.LVL32:
 503:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[7+2*len] = crc & 0xff;
 543              		.loc 1 503 0
 544 008e A044     		add	r8, r8, r4
 545 0090 88F81000 		strb	r0, [r8, #16]
 504:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[8+2*len] = (crc >> 8) & 0xff;
 546              		.loc 1 504 0
 547 0094 6319     		adds	r3, r4, r5
 548 0096 000A     		lsrs	r0, r0, #8
 549              	.LVL33:
 505:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 506:uc_libc_dev/protocol/modbus/modbus_master.c ****     // enviar a query para o escravo
 507:uc_libc_dev/protocol/modbus/modbus_master.c ****     if (modbus.ps(modbus.querie, 9+2*len) < 0) {
 550              		.loc 1 507 0
 551 0098 05F10901 		add	r1, r5, #9
 504:uc_libc_dev/protocol/modbus/modbus_master.c ****     modbus.querie[8+2*len] = (crc >> 8) & 0xff;
 552              		.loc 1 504 0
 553 009c 1876     		strb	r0, [r3, #24]
 554              		.loc 1 507 0
 555 009e 89B2     		uxth	r1, r1
 556 00a0 2368     		ldr	r3, [r4]
 557 00a2 07F11000 		add	r0, r7, #16
 558 00a6 9847     		blx	r3
 559              	.LVL34:
 560 00a8 0028     		cmp	r0, #0
 508:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.sts = errMODBUS_TX;
 561              		.loc 1 508 0
 562 00aa B5BF     		itete	lt
 563 00ac 6FF07A03 		mvnlt	r3, #122
 509:uc_libc_dev/protocol/modbus/modbus_master.c ****         return pdFAIL;
 510:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 511:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 512:uc_libc_dev/protocol/modbus/modbus_master.c ****    	// sinalisa que vamos esperar a resposta do escravo
 513:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus.waitResponse = pdTRUE;
 564              		.loc 1 513 0
 565 00b0 0126     		movge	r6, #1
 508:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.sts = errMODBUS_TX;
 566              		.loc 1 508 0
 567 00b2 C7F83431 		strlt	r3, [r7, #308]
 568              		.loc 1 513 0
 569 00b6 C7F81861 		strge	r6, [r7, #280]
 514:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 515:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#if (MODBUSM_USE_DEBUG == pdON)
 516:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus_printf("modbusM: TX WRs: ");
 517:uc_libc_dev/protocol/modbus/modbus_master.c **** 	for (x=0;x<9+2*len;x++) modbus_printf("0x%x ", modbus.querie[x]);
 518:uc_libc_dev/protocol/modbus/modbus_master.c **** 	modbus_printf(CMD_TERMINATOR);
 519:uc_libc_dev/protocol/modbus/modbus_master.c **** 	#endif
 520:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 521:uc_libc_dev/protocol/modbus/modbus_master.c ****     return pdPASS;
 570              		.loc 1 521 0
 571 00ba 00E0     		b	.L34
 572              	.LVL35:
 573              	.L38:
 476:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 574              		.loc 1 476 0
 575 00bc 0026     		movs	r6, #0
 576              	.LVL36:
 577              	.L34:
 522:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 578              		.loc 1 522 0
 579 00be 3046     		mov	r0, r6
 580 00c0 BDE8F081 		pop	{r4, r5, r6, r7, r8, pc}
 581              	.L41:
 582              		.align	2
 583              	.L40:
 584 00c4 00000000 		.word	.LANCHOR0
 585              		.cfi_endproc
 586              	.LFE11:
 588              		.section	.text.modbus_MasterProcess,"ax",%progbits
 589              		.align	1
 590              		.global	modbus_MasterProcess
 591              		.thumb
 592              		.thumb_func
 594              	modbus_MasterProcess:
 595              	.LFB12:
 523:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 524:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 525:uc_libc_dev/protocol/modbus/modbus_master.c **** // FUNÇÃO:		modbus_MasterProcess
 526:uc_libc_dev/protocol/modbus/modbus_master.c **** // Descrição: 	Processa as respostas do escravo mediante as requisiççies de comandos
 527:uc_libc_dev/protocol/modbus/modbus_master.c **** // ------------------------------------------------------------------------------------------------
 528:uc_libc_dev/protocol/modbus/modbus_master.c **** void modbus_MasterProcess(void) {
 596              		.loc 1 528 0
 597              		.cfi_startproc
 598              		@ args = 0, pretend = 0, frame = 8
 599              		@ frame_needed = 0, uses_anonymous_args = 0
 600 0000 73B5     		push	{r0, r1, r4, r5, r6, lr}
 601              	.LCFI3:
 602              		.cfi_def_cfa_offset 24
 603              		.cfi_offset 4, -16
 604              		.cfi_offset 5, -12
 605              		.cfi_offset 6, -8
 606              		.cfi_offset 14, -4
 607              	.LBB11:
 608              	.LBB12:
 218:uc_libc_dev/protocol/modbus/modbus_master.c **** 		len = 0;
 609              		.loc 1 218 0
 610 0002 634C     		ldr	r4, .L78
 611 0004 D4F81831 		ldr	r3, [r4, #280]
 612 0008 2546     		mov	r5, r4
 613 000a 43B9     		cbnz	r3, .L43
 219:uc_libc_dev/protocol/modbus/modbus_master.c **** 		firstByte = pdTRUE;
 614              		.loc 1 219 0
 615 000c 614A     		ldr	r2, .L78+4
 616 000e 1360     		str	r3, [r2]
 220:uc_libc_dev/protocol/modbus/modbus_master.c **** 		modbus.tout = modbus.timeout;
 617              		.loc 1 220 0
 618 0010 614B     		ldr	r3, .L78+8
 619 0012 0122     		movs	r2, #1
 620 0014 1A60     		str	r2, [r3]
 221:uc_libc_dev/protocol/modbus/modbus_master.c **** 		return 0;
 621              		.loc 1 221 0
 622 0016 E368     		ldr	r3, [r4, #12]
 623 0018 C4F81C31 		str	r3, [r4, #284]
 624 001c B6E0     		b	.L42
 625              	.L43:
 225:uc_libc_dev/protocol/modbus/modbus_master.c ****         #if (MODBUSM_USE_DEBUG == pdON)
 626              		.loc 1 225 0
 627 001e 6368     		ldr	r3, [r4, #4]
 628 0020 0DF10700 		add	r0, sp, #7
 629 0024 9847     		blx	r3
 630              	.LVL37:
 631 0026 0128     		cmp	r0, #1
 632 0028 10D1     		bne	.L45
 230:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 633              		.loc 1 230 0
 634 002a 5B4B     		ldr	r3, .L78+8
 635 002c 0022     		movs	r2, #0
 636 002e 1A60     		str	r2, [r3]
 232:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.querie[len++] = dat;			// Adiciona o dado no buffer e aponta para o próximo indice d
 637              		.loc 1 232 0
 638 0030 584A     		ldr	r2, .L78+4
 639 0032 1368     		ldr	r3, [r2]
 640 0034 FF2B     		cmp	r3, #255
 641 0036 2CDC     		bgt	.L57
 233:uc_libc_dev/protocol/modbus/modbus_master.c **** 		modbus.timeDataIn = modbusTIME_DATE_IN;			// Tempo de espera de recebimento de dados do escravo
 642              		.loc 1 233 0
 643 0038 591C     		adds	r1, r3, #1
 644 003a 1160     		str	r1, [r2]
 645 003c 9DF80720 		ldrb	r2, [sp, #7]	@ zero_extendqisi2
 646 0040 2344     		add	r3, r3, r4
 647 0042 1A74     		strb	r2, [r3, #16]
 234:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 648              		.loc 1 234 0
 649 0044 C823     		movs	r3, #200
 650 0046 C4F82031 		str	r3, [r4, #288]
 651 004a 9FE0     		b	.L42
 652              	.L45:
 240:uc_libc_dev/protocol/modbus/modbus_master.c ****         if (!firstByte) {
 653              		.loc 1 240 0
 654 004c D4F82031 		ldr	r3, [r4, #288]
 655 0050 002B     		cmp	r3, #0
 656 0052 40F09B80 		bne	.L42
 241:uc_libc_dev/protocol/modbus/modbus_master.c ****         	if (len < 3) {
 657              		.loc 1 241 0
 658 0056 504B     		ldr	r3, .L78+8
 659 0058 1B68     		ldr	r3, [r3]
 660 005a 9BB9     		cbnz	r3, .L46
 661              	.LBB13:
 242:uc_libc_dev/protocol/modbus/modbus_master.c **** 		        #if (MODBUSM_USE_DEBUG == pdON)
 662              		.loc 1 242 0
 663 005c 4D4C     		ldr	r4, .L78+4
 664 005e 2168     		ldr	r1, [r4]
 665 0060 0229     		cmp	r1, #2
 666 0062 19DD     		ble	.L59
 252:uc_libc_dev/protocol/modbus/modbus_master.c ****             u16 crc = (modbus.querie[len-1] << 8 ) | modbus.querie[len-2];
 667              		.loc 1 252 0
 668 0064 0239     		subs	r1, r1, #2
 669 0066 05F11000 		add	r0, r5, #16
 670 006a FFF7FEFF 		bl	crc16_MODBUS
 671              	.LVL38:
 253:uc_libc_dev/protocol/modbus/modbus_master.c ****             if (crc != crc_calc) {
 672              		.loc 1 253 0
 673 006e 2368     		ldr	r3, [r4]
 674              	.LVL39:
 675 0070 2B44     		add	r3, r3, r5
 676              	.LVL40:
 254:uc_libc_dev/protocol/modbus/modbus_master.c **** 		        #if (MODBUSM_USE_DEBUG == pdON)
 677              		.loc 1 254 0
 678 0072 DA7B     		ldrb	r2, [r3, #15]	@ zero_extendqisi2
 679 0074 9B7B     		ldrb	r3, [r3, #14]	@ zero_extendqisi2
 680 0076 43EA0223 		orr	r3, r3, r2, lsl #8
 681 007a 9842     		cmp	r0, r3
 682 007c 0FD0     		beq	.L60
 259:uc_libc_dev/protocol/modbus/modbus_master.c ****             } else return pdPASS;
 683              		.loc 1 259 0
 684 007e 6FF07903 		mvn	r3, #121
 685 0082 0DE0     		b	.L75
 686              	.LVL41:
 687              	.L46:
 688              	.LBE13:
 263:uc_libc_dev/protocol/modbus/modbus_master.c **** 			#if (MODBUSM_USE_DEBUG == pdON)
 689              		.loc 1 263 0
 690 0084 D4F81C31 		ldr	r3, [r4, #284]
 691 0088 002B     		cmp	r3, #0
 692 008a 7FD1     		bne	.L42
 268:uc_libc_dev/protocol/modbus/modbus_master.c ****         }
 693              		.loc 1 268 0
 694 008c 6FF07B03 		mvn	r3, #123
 695 0090 06E0     		b	.L75
 696              	.L57:
 232:uc_libc_dev/protocol/modbus/modbus_master.c ****         modbus.querie[len++] = dat;			// Adiciona o dado no buffer e aponta para o próximo indice d
 697              		.loc 1 232 0
 698 0092 6FF07C03 		mvn	r3, #124
 699 0096 03E0     		b	.L75
 700              	.L59:
 701              	.LBB14:
 247:uc_libc_dev/protocol/modbus/modbus_master.c ****         	}
 702              		.loc 1 247 0
 703 0098 6FF07D03 		mvn	r3, #125
 704 009c 00E0     		b	.L75
 705              	.LVL42:
 706              	.L60:
 260:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 707              		.loc 1 260 0
 708 009e 0123     		movs	r3, #1
 709              	.LVL43:
 710              	.L75:
 711 00a0 002B     		cmp	r3, #0
 712              	.LBE14:
 713              	.LBE12:
 714              	.LBE11:
 529:uc_libc_dev/protocol/modbus/modbus_master.c ****     int ret = GetPacket(); // retorna
 530:uc_libc_dev/protocol/modbus/modbus_master.c **** 		//		Quantidade de bytes recebidos com sucesso
 531:uc_libc_dev/protocol/modbus/modbus_master.c **** 		//		0: Não está esperando pela resposta do escravo
 532:uc_libc_dev/protocol/modbus/modbus_master.c **** 		//		errMODBUS_BUFFER_OVERFLOW
 533:uc_libc_dev/protocol/modbus/modbus_master.c **** 		//  	errMODBUS_LENPACKET
 534:uc_libc_dev/protocol/modbus/modbus_master.c **** 		//  	errMODBUS_CRC
 535:uc_libc_dev/protocol/modbus/modbus_master.c **** 		//  	errMODBUS_TIMEOUT
 536:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 537:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (ret == 0 ) return;
 538:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret < 0 ) {
 715              		.loc 1 538 0
 716 00a2 05DA     		bge	.L48
 539:uc_libc_dev/protocol/modbus/modbus_master.c ****    		modbus.sts = ret; 				// salva o erro
 717              		.loc 1 539 0
 718 00a4 C5F83431 		str	r3, [r5, #308]
 540:uc_libc_dev/protocol/modbus/modbus_master.c ****    		modbus.waitResponse = pdFALSE; 	// sinaliza que não estamos esperando pela resposta do escravo
 719              		.loc 1 540 0
 720 00a8 0023     		movs	r3, #0
 721 00aa C5F81831 		str	r3, [r5, #280]
 722 00ae 6DE0     		b	.L42
 723              	.L48:
 541:uc_libc_dev/protocol/modbus/modbus_master.c **** 	} else {
 542:uc_libc_dev/protocol/modbus/modbus_master.c **** 		if (modbus.cmd == 3) 		modbus.sts = ProcessCmd3();	// retorna	pdPASS errMODBUS_ID	errMODBUS_CMD e
 724              		.loc 1 542 0
 725 00b0 D5F81431 		ldr	r3, [r5, #276]
 726 00b4 364C     		ldr	r4, .L78
 727 00b6 032B     		cmp	r3, #3
 728 00b8 2DD1     		bne	.L49
 729              	.LBB15:
 730              	.LBB16:
 286:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret != pdPASS ) return ret;
 731              		.loc 1 286 0
 732 00ba FFF7FEFF 		bl	ValidatePacket
 733              	.LVL44:
 287:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 734              		.loc 1 287 0
 735 00be 0128     		cmp	r0, #1
 736 00c0 62D1     		bne	.L56
 294:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 737              		.loc 1 294 0
 738 00c2 D4F82821 		ldr	r2, [r4, #296]
 739 00c6 A17C     		ldrb	r1, [r4, #18]	@ zero_extendqisi2
 289:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 740              		.loc 1 289 0
 741 00c8 0023     		movs	r3, #0
 294:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 742              		.loc 1 294 0
 743 00ca B1EB420F 		cmp	r1, r2, lsl #1
 289:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 744              		.loc 1 289 0
 745 00ce C4F81431 		str	r3, [r4, #276]
 290:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 746              		.loc 1 290 0
 747 00d2 C4F81831 		str	r3, [r4, #280]
 748              	.LVL45:
 294:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 749              		.loc 1 294 0
 750 00d6 1BD1     		bne	.L63
 751 00d8 1846     		mov	r0, r3
 752              	.LVL46:
 753 00da D4F82411 		ldr	r1, [r4, #292]
 754 00de 1334     		adds	r4, r4, #19
 755              	.LVL47:
 756              	.L51:
 297:uc_libc_dev/protocol/modbus/modbus_master.c ****        	*modbus.regs++ = (modbus.querie[2*x+3] << 8) | (modbus.querie[2*x+4]);
 757              		.loc 1 297 0
 758 00e0 8242     		cmp	r2, r0
 759 00e2 04F10204 		add	r4, r4, #2
 760 00e6 0ADD     		ble	.L77
 298:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 761              		.loc 1 298 0
 762 00e8 14F8026C 		ldrb	r6, [r4, #-2]	@ zero_extendqisi2
 763 00ec 14F8013C 		ldrb	r3, [r4, #-1]	@ zero_extendqisi2
 764 00f0 43EA0623 		orr	r3, r3, r6, lsl #8
 765 00f4 21F81030 		strh	r3, [r1, r0, lsl #1]	@ movhi
 297:uc_libc_dev/protocol/modbus/modbus_master.c ****        	*modbus.regs++ = (modbus.querie[2*x+3] << 8) | (modbus.querie[2*x+4]);
 766              		.loc 1 297 0
 767 00f8 0130     		adds	r0, r0, #1
 768              	.LVL48:
 769 00fa 0123     		movs	r3, #1
 770 00fc F0E7     		b	.L51
 771              	.L77:
 772 00fe 22EAE272 		bic	r2, r2, r2, asr #31
 773 0102 01EB4202 		add	r2, r1, r2, lsl #1
 774 0106 0BB1     		cbz	r3, .L53
 775 0108 C5F82421 		str	r2, [r5, #292]
 776              	.L53:
 300:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 777              		.loc 1 300 0
 778 010c 0120     		movs	r0, #1
 779              	.LVL49:
 780 010e 3BE0     		b	.L56
 781              	.LVL50:
 782              	.L63:
 294:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 783              		.loc 1 294 0
 784 0110 6FF08200 		mvn	r0, #130
 785              	.LVL51:
 786 0114 38E0     		b	.L56
 787              	.L49:
 788              	.LBE16:
 789              	.LBE15:
 543:uc_libc_dev/protocol/modbus/modbus_master.c **** 		else if (modbus.cmd == 6) 	modbus.sts = ProcessCmd6();	// retorna	pdPASS errMODBUS_ID	errMODBUS_C
 790              		.loc 1 543 0
 791 0116 062B     		cmp	r3, #6
 792 0118 17D1     		bne	.L54
 793              	.LBB17:
 794              	.LBB18:
 315:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret != pdPASS ) return ret;
 795              		.loc 1 315 0
 796 011a FFF7FEFF 		bl	ValidatePacket
 797              	.LVL52:
 316:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 798              		.loc 1 316 0
 799 011e 0128     		cmp	r0, #1
 800 0120 32D1     		bne	.L56
 318:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 801              		.loc 1 318 0
 802 0122 0023     		movs	r3, #0
 803 0124 C4F81431 		str	r3, [r4, #276]
 319:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 804              		.loc 1 319 0
 805 0128 C4F81831 		str	r3, [r4, #280]
 806              	.LVL53:
 323:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 807              		.loc 1 323 0
 808 012c 638A     		ldrh	r3, [r4, #18]
 809 012e D4F82C21 		ldr	r2, [r4, #300]
 810 0132 5BBA     		rev16	r3, r3
 811 0134 9BB2     		uxth	r3, r3
 812 0136 9342     		cmp	r3, r2
 813 0138 24D1     		bne	.L68
 814              	.LVL54:
 327:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 815              		.loc 1 327 0
 816 013a 217D     		ldrb	r1, [r4, #20]	@ zero_extendqisi2
 817 013c 637D     		ldrb	r3, [r4, #21]	@ zero_extendqisi2
 818 013e B4F83021 		ldrh	r2, [r4, #304]
 819 0142 43EA0123 		orr	r3, r3, r1, lsl #8
 820 0146 9A42     		cmp	r2, r3
 821 0148 17E0     		b	.L76
 822              	.LVL55:
 823              	.L54:
 824              	.LBE18:
 825              	.LBE17:
 544:uc_libc_dev/protocol/modbus/modbus_master.c **** 		else if (modbus.cmd == 16) 	modbus.sts = ProcessCmd16();// retorna	pdPASS errMODBUS_ID	errMODBUS_
 826              		.loc 1 544 0
 827 014a 102B     		cmp	r3, #16
 828 014c 1ED1     		bne	.L42
 829              	.LBB19:
 830              	.LBB20:
 344:uc_libc_dev/protocol/modbus/modbus_master.c ****    	if (ret != pdPASS ) return ret;
 831              		.loc 1 344 0
 832 014e FFF7FEFF 		bl	ValidatePacket
 833              	.LVL56:
 345:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 834              		.loc 1 345 0
 835 0152 0128     		cmp	r0, #1
 836 0154 18D1     		bne	.L56
 347:uc_libc_dev/protocol/modbus/modbus_master.c ****   	modbus.waitResponse = pdFALSE; // sinaliza que não estamos esperando pela resposta do escravo
 837              		.loc 1 347 0
 838 0156 0023     		movs	r3, #0
 839 0158 C4F81431 		str	r3, [r4, #276]
 348:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 840              		.loc 1 348 0
 841 015c C4F81831 		str	r3, [r4, #280]
 842              	.LVL57:
 352:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 843              		.loc 1 352 0
 844 0160 638A     		ldrh	r3, [r4, #18]
 845 0162 D4F82C21 		ldr	r2, [r4, #300]
 846 0166 5BBA     		rev16	r3, r3
 847 0168 9BB2     		uxth	r3, r3
 848 016a 9342     		cmp	r3, r2
 849 016c 0AD1     		bne	.L68
 850              	.LVL58:
 356:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 851              		.loc 1 356 0
 852 016e A38A     		ldrh	r3, [r4, #20]
 853 0170 D4F82821 		ldr	r2, [r4, #296]
 854 0174 5BBA     		rev16	r3, r3
 855 0176 9BB2     		uxth	r3, r3
 856 0178 9342     		cmp	r3, r2
 857              	.LVL59:
 858              	.L76:
 859 017a 0CBF     		ite	eq
 860 017c 0120     		moveq	r0, #1
 861 017e 6FF08300 		mvnne	r0, #131
 862 0182 01E0     		b	.L56
 863              	.L68:
 352:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 864              		.loc 1 352 0
 865 0184 6FF07F00 		mvn	r0, #127
 866              	.L56:
 867              	.LBE20:
 868              	.LBE19:
 869              		.loc 1 544 0
 870 0188 C5F83401 		str	r0, [r5, #308]
 871              	.L42:
 545:uc_libc_dev/protocol/modbus/modbus_master.c **** 	}
 546:uc_libc_dev/protocol/modbus/modbus_master.c **** }
 872              		.loc 1 546 0
 873 018c 02B0     		add	sp, sp, #8
 874              	.LCFI4:
 875              		.cfi_def_cfa_offset 16
 876              		@ sp needed
 877 018e 70BD     		pop	{r4, r5, r6, pc}
 878              	.L79:
 879              		.align	2
 880              	.L78:
 881 0190 00000000 		.word	.LANCHOR0
 882 0194 00000000 		.word	.LANCHOR1
 883 0198 00000000 		.word	.LANCHOR2
 884              		.cfi_endproc
 885              	.LFE12:
 887              		.section	.text.modbus_MasterTick,"ax",%progbits
 888              		.align	1
 889              		.global	modbus_MasterTick
 890              		.thumb
 891              		.thumb_func
 893              	modbus_MasterTick:
 894              	.LFB13:
 547:uc_libc_dev/protocol/modbus/modbus_master.c **** 
 548:uc_libc_dev/protocol/modbus/modbus_master.c **** //-------------------------------------------------------------------------------------------------
 549:uc_libc_dev/protocol/modbus/modbus_master.c **** // Esta função deve ser chamada a cada 1ms
 550:uc_libc_dev/protocol/modbus/modbus_master.c **** //-------------------------------------------------------------------------------------------------
 551:uc_libc_dev/protocol/modbus/modbus_master.c **** void modbus_MasterTick(void) {
 895              		.loc 1 551 0
 896              		.cfi_startproc
 897              		@ args = 0, pretend = 0, frame = 0
 898              		@ frame_needed = 0, uses_anonymous_args = 0
 899              		@ link register save eliminated.
 552:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.tout) modbus.tout--;
 900              		.loc 1 552 0
 901 0000 094B     		ldr	r3, .L89
 902 0002 D3F81C21 		ldr	r2, [r3, #284]
 903 0006 22B1     		cbz	r2, .L81
 904              		.loc 1 552 0 is_stmt 0 discriminator 1
 905 0008 D3F81C21 		ldr	r2, [r3, #284]
 906 000c 013A     		subs	r2, r2, #1
 907 000e C3F81C21 		str	r2, [r3, #284]
 908              	.L81:
 553:uc_libc_dev/protocol/modbus/modbus_master.c **** 	if (modbus.timeDataIn) modbus.timeDataIn--;
 909              		.loc 1 553 0 is_stmt 1
 910 0012 D3F82031 		ldr	r3, [r3, #288]
 911 0016 044A     		ldr	r2, .L89
 912 0018 23B1     		cbz	r3, .L80
 913              		.loc 1 553 0 is_stmt 0 discriminator 1
 914 001a D2F82031 		ldr	r3, [r2, #288]
 915 001e 013B     		subs	r3, r3, #1
 916 0020 C2F82031 		str	r3, [r2, #288]
 917              	.L80:
 918 0024 7047     		bx	lr
 919              	.L90:
 920 0026 00BF     		.align	2
 921              	.L89:
 922 0028 00000000 		.word	.LANCHOR0
 923              		.cfi_endproc
 924              	.LFE13:
 926              		.section	.data.firstByte.4328,"aw",%progbits
 927              		.align	2
 928              		.set	.LANCHOR2,. + 0
 931              	firstByte.4328:
 932 0000 01000000 		.word	1
 933              		.section	.bss.modbus,"aw",%nobits
 934              		.align	2
 935              		.set	.LANCHOR0,. + 0
 938              	modbus:
 939 0000 00000000 		.space	316
 939      00000000 
 939      00000000 
 939      00000000 
 939      00000000 
 940              		.section	.bss.len.4327,"aw",%nobits
 941              		.align	2
 942              		.set	.LANCHOR1,. + 0
 945              	len.4327:
 946 0000 00000000 		.space	4
 947              		.text
 948              	.Letext0:
 949              		.file 2 "uc_libc_dev/_libdef/uc_libdefs.h"
 950              		.file 3 "uc_libc_dev/crc/crc.h"
DEFINED SYMBOLS
                            *ABS*:00000000 modbus_master.c
D:\_temp\_windows\cc9Xk4Pe.s:20     .text.ValidatePacket:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:24     .text.ValidatePacket:00000000 ValidatePacket
D:\_temp\_windows\cc9Xk4Pe.s:71     .text.ValidatePacket:0000003c $d
D:\_temp\_windows\cc9Xk4Pe.s:76     .text.modbus_MasterInit:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:81     .text.modbus_MasterInit:00000000 modbus_MasterInit
D:\_temp\_windows\cc9Xk4Pe.s:119    .text.modbus_MasterInit:00000030 $d
D:\_temp\_windows\cc9Xk4Pe.s:124    .text.modbus_MasterTimeout:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:129    .text.modbus_MasterTimeout:00000000 modbus_MasterTimeout
D:\_temp\_windows\cc9Xk4Pe.s:144    .text.modbus_MasterTimeout:00000008 $d
D:\_temp\_windows\cc9Xk4Pe.s:149    .text.modbus_MasterReadStatus:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:154    .text.modbus_MasterReadStatus:00000000 modbus_MasterReadStatus
D:\_temp\_windows\cc9Xk4Pe.s:168    .text.modbus_MasterReadStatus:00000008 $d
D:\_temp\_windows\cc9Xk4Pe.s:173    .text.modbus_MasterReadException:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:178    .text.modbus_MasterReadException:00000000 modbus_MasterReadException
D:\_temp\_windows\cc9Xk4Pe.s:192    .text.modbus_MasterReadException:00000008 $d
D:\_temp\_windows\cc9Xk4Pe.s:197    .text.modbus_MasterReadRegisters:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:202    .text.modbus_MasterReadRegisters:00000000 modbus_MasterReadRegisters
D:\_temp\_windows\cc9Xk4Pe.s:310    .text.modbus_MasterReadRegisters:00000078 $d
D:\_temp\_windows\cc9Xk4Pe.s:315    .text.modbus_MasterWriteRegister:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:320    .text.modbus_MasterWriteRegister:00000000 modbus_MasterWriteRegister
D:\_temp\_windows\cc9Xk4Pe.s:426    .text.modbus_MasterWriteRegister:00000080 $d
D:\_temp\_windows\cc9Xk4Pe.s:431    .text.modbus_MasterWriteRegisters:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:436    .text.modbus_MasterWriteRegisters:00000000 modbus_MasterWriteRegisters
D:\_temp\_windows\cc9Xk4Pe.s:584    .text.modbus_MasterWriteRegisters:000000c4 $d
D:\_temp\_windows\cc9Xk4Pe.s:589    .text.modbus_MasterProcess:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:594    .text.modbus_MasterProcess:00000000 modbus_MasterProcess
D:\_temp\_windows\cc9Xk4Pe.s:881    .text.modbus_MasterProcess:00000190 $d
D:\_temp\_windows\cc9Xk4Pe.s:888    .text.modbus_MasterTick:00000000 $t
D:\_temp\_windows\cc9Xk4Pe.s:893    .text.modbus_MasterTick:00000000 modbus_MasterTick
D:\_temp\_windows\cc9Xk4Pe.s:922    .text.modbus_MasterTick:00000028 $d
D:\_temp\_windows\cc9Xk4Pe.s:927    .data.firstByte.4328:00000000 $d
D:\_temp\_windows\cc9Xk4Pe.s:931    .data.firstByte.4328:00000000 firstByte.4328
D:\_temp\_windows\cc9Xk4Pe.s:934    .bss.modbus:00000000 $d
D:\_temp\_windows\cc9Xk4Pe.s:938    .bss.modbus:00000000 modbus
D:\_temp\_windows\cc9Xk4Pe.s:941    .bss.len.4327:00000000 $d
D:\_temp\_windows\cc9Xk4Pe.s:945    .bss.len.4327:00000000 len.4327
                     .debug_frame:00000010 $d

UNDEFINED SYMBOLS
crc16_MODBUS
